<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 1000px;
            height: 200px;
            background-color: #f00;
            margin: 50px auto;
            position: relative;
        }

        .range {
            width: 100px;
            height: 100px;
            /* position: absolute; */
            background-color: green;
            font-size: 50px;
            text-align: center;
            line-height: 100px;
            user-select: none;
            margin-left: 50px;
        }
    </style>
</head>

<body>

    <div class="box">
        <div class="range">>></div>
        <span>2222</span>
    </div>

    <script>

        // 目标源   ----  具体触发事件的对象
        //    offsetX / offsetY  鼠标距离目标源的坐标

        var oBox = document.querySelector('.box');
        var oRange = oBox.querySelector('.range');

        oBox.onclick = function (e) {
            console.log(e.offsetX);
        }

    </script>

</body>

</html>